package com.work12;

import java.util.*;

public class Test {
    public static void main(String[] args) {
        //先生成一个
        TreeSet<Ball> allBalls = new TreeSet<>();
        //先生成红球
        Random random = new Random();
        for (int i = 0; i < 6; i++) {
           int num = random.nextInt(33)+1;
            Ball redBall = new Ball("红球", Integer.toString(num));
            allBalls.add(redBall);
        }
        List<Integer> redBalls = new ArrayList<>();
        for (Ball ball : allBalls) {
           redBalls.add(Integer.valueOf(ball.getNum()));
        }

        Collections.sort(redBalls,((o1, o2) -> o1 - o2));
        System.out.println(redBalls);
        int blueNum = random.nextInt(16) + 1;
        allBalls.add(new Ball("篮球",Integer.toString(blueNum)));

        System.out.println("红球为"+redBalls + "篮球为" + blueNum);

    }
}
